package com.framework.network.interceptor.commoninter

import android.content.Context
import com.framework.network.manager.NetworkManager
import okhttp3.Request

/**
 * @ClassName: GetRequestParams
 * @Description: Get请求添加公参
 * @Author: you
 */
class GetRequestParams(context: Context) : IRequestParam {
    override fun getRequest(request: Request, context: Context): Request {
        //添加公共参数
        val mBuilder = request.url.newBuilder()
        NetworkManager.getInstance().create().commonMap?.forEach {
            it.run {
                mBuilder.addQueryParameter(key, value.toString())
            }
        }
        return request.newBuilder().url(mBuilder.build()).build()
    }
}
